package xyz.zhouzhaodong.crm.controller;


import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.zhouzhaodong.crm.dto.StationDto;
import xyz.zhouzhaodong.crm.entity.Station;
import xyz.zhouzhaodong.crm.service.IStationService;
import xyz.zhouzhaodong.crm.util.NoRepeatSubmit;
import xyz.zhouzhaodong.crm.util.RestMessage;

import javax.annotation.Resource;

/**
 * <p>
 * 岗位表 前端控制器
 * </p>
 *
 * @author zhouzhaodong
 * @since 2020-06-10
 */
@RestController
@RequestMapping("/station")
public class StationController {

    @Resource
    IStationService stationService;

    /**
     * 新增
     * @param stationDto
     * @return
     */
    @NoRepeatSubmit
    @RequestMapping("/add")
    public RestMessage add(StationDto stationDto){
        return stationService.addStation(stationDto);
    }

    /**
     * 删除
     * @param id
     * @param staffId
     * @return
     */
    @RequestMapping("/delete")
    public RestMessage delete(String id, String staffId){
        return stationService.deleteStation(id, staffId);
    }

    /**
     * 修改
     * @param stationDto
     * @return
     */
    @RequestMapping("/update")
    public RestMessage update(StationDto stationDto){
        return stationService.updateStation(stationDto);
    }

    /**
     * 根据id查询岗位
     * @param id
     * @return
     */
    @RequestMapping("/selectOne")
    public RestMessage selectOne(String id){
        return stationService.selectOne(id);
    }

    /**
     * 根据条件查询列表
     * @param stationDto
     * @return
     */
    @RequestMapping("/selectList")
    public RestMessage selectList(StationDto stationDto){
        return stationService.selectList(stationDto);
    }

}
